package com.yc.dygang.util;

import com.google.gson.Gson;

import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

public class Util {
    public static void toJson(Object obj, HttpServletResponse response) throws IOException {
        String json = new Gson().toJson(obj);
        response.setContentType("application/json;charset=utf-8");
        response.getWriter().append(json);
    }
}
